package com.foton.lotteryinfrastructure.infrastru.dao;

import com.foton.lotteryinfrastructure.infrastru.po.StrategyDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import javax.annotation.security.PermitAll;
import java.util.List;

/**
 * @Author RenPu
 * @Date 2023/11/24 10:42
 * @Version 1.0
 * @Description: 抽奖策略详情 DAO
 **/

@Mapper
public interface IStrategyDetailDao {


    /**
     * 根据策略ID 查询对应的策略信息
     *
     * @param strategyId
     * @return
     */
    List<StrategyDetail> queryStrategyDetailList(Long strategyId);


    /**
     * 查询库存为0的商品ID值，便于在业务逻辑层对抽到此类商品做处理
     *
     * @param strategyId
     * @return
     */
    List<String> queryNoStockStrategyAwardList(Long strategyId);


    /**
     * 针对策略详情的，商品数量进行扣减，根据策略ID值，奖品ID作为条件扣减\
     *
     * @return
     */
    int deductStock(StrategyDetail strategyDetail);

    /**
     * 插入策略配置组
     *
     * @param req 策略配置组
     */
    void insertList(List<StrategyDetail> list);

}
